		
		<script>
		$(document).ready(function(){
			$(document).tooltip({
				selector: "[data-toggle='tooltip']"
			});
		});
		</script>
		<br/>
		<div class="wrapper clearfix">
            <?php if($this->session->userdata('id') != '') {$this->load->view('com_tutors/views_steps_success.php');} ?>
            <?php $this->load->view('com_search/col_left.php');?>
		<!-- /.cl_left -->
		<div class="primary">
			<header class="top_pr clearfix">
				<h3 class="title_primary">Hiện có <span><?php echo $number; ?></span> lớp cần gia sư</h3>
				<div class="left">
					<label>
						<select name="ajax_box1" class="box1_select guidulieu_ajax">
							<option value="5" <?php if($this->session->userdata('order')==5){echo ' selected="selected" ';}?> >-- Phân loại --</option>
							<option value="1" <?php if($this->session->userdata('order')==1){echo ' selected="selected" ';}?> >-- Mới nhất --</option>
							<option value="2" <?php if($this->session->userdata('order')==2){echo ' selected="selected" ';}?> >-- Cũ nhất --</option>
                            <option value="3" <?php if($this->session->userdata('order')==3){echo ' selected="selected" ';}?> >-- Môn học --</option> 
                        </select>
					</label>
				</div>
                <script>
                    $(document).ready(function(){
                       $('.guidulieu_ajax').change(function(){
                        var action = $('.guidulieu_ajax').val();
                             $.ajax({
                                      type: "POST",
                                      url: '<?php echo base_url(); ?>tim-gia-su.html',
                                      data: {
                                        action : action,
                                        },
                                      success: success
                                    });
                                   });
                       function success(data,status){
                                   location.reload();
                               };
                    });
                </script>
			</header>
			<article id="main_primary">
				<?php 
				if(!empty($lop)){ 
					foreach ($lop as $lop){
						$mon 	= $this->common_model->getone('subjects', array('title' => $lop->monhoc));
						$sub 	= false;
						$test 	= false;
						if(!empty($subjects)){
							foreach($subjects as $subject){
								if($subject == $mon->id){
									$sub = true;
								}
							}
						}
						if(!empty($subtests)){
							foreach($subtests as $subtest){
								if($subtest == $mon->id){
									$test = true;
								}
							}
						}
				?>
                    <section class="list_lop">
						<h3 class="title-lop"><b><?php echo $lop->firstname.' '.$lop->name ?></b> Cần tìm gia sư môn: <b><?php echo $lop->monhoc; ?></b></h3>
						<div class="noidung">
							<?php echo $lop->noidung; ?>
							<p class="date-create">Gửi vào lúc: <?php echo $lop->date; ?></p>
						</div>
				<?php
						if($this->session->userdata('id')){
							if($sub){
								if($test){
									echo '<a href="'.base_url().'gia-su/nhan-day/'.$lop->id.'.html" class="btn_view btn_amply" title="Dạy lớp này">Đồng ý ! Dạy '.$lop->name.'</a>';
								} else {
									echo '<a href="'.base_url().'bai-test/'.$mon->alias.'.html" class="btn_view btn_amply" title="Làm bài test môn này">Làm bài test môn này</a>';
								}
							} else {
								echo '<a href="'.base_url().'gia-su/mon-hoc.html" class="btn_view btn_amply" title="Thêm môn dạy và làm bài test">Thêm môn dạy và làm bài test</a>';
							}
						} else {
									echo '<a href="'.base_url().'gia-su/nhan-day/'.$lop->id.'.html" class="btn_view btn_amply" title="Dạy lớp này">Đồng ý ! Dạy '.$lop->name.'</a>';
						}
				?>
                    </section>
				<?php 
					} 
				} else {
					echo 'Hiện tại không có lớp nào';
				} 
				?>
			     <footer id="footer_pri">
				<a href="#" class="btn_top">Đầu trang</a>
				<div class="page_navi">
                    <?php echo $this->pagination->create_links();?>
				</div>
				<!-- /.page_navi -->
			</footer>
            </article>
			<!-- /#main_primary -->
		</div>
		<!-- /.primary -->
		</div>
		<!-- /.wrapper -->
<!-- Script Search Advand -->
<style>

.date-create
{
    margin-top:15px;
    color:#777777;
    font-style:italic;
}
.list_lop
{
    border-bottom:1px solid #ccc;
    padding-bottom:30px;
    margin:10px 0px;
    position:relative;
}
.btn_amply
{
    position:absolute;
    width:200px;
    height:20px;
    color:#fff!important;
    right:10px;
    top:35%;
}
.title-lop
{
    color:#333;
    font-weight:500;
    font-size:16px;
}
</style>
